package com.lvyuely.common.web.core.pojo;

import java.util.HashMap;
import java.util.Map;

/**
 * Simple to Introduction
 * <pre>
 * <b>项目</b> :  letsin-server
 * <b>包名</b> :  com.letsin.server.vo
 * <b>类名</b> :  ActionResult
 * <b>描述</b> :
 * <b>版权</b> :  Copyright (c) 1999-2014 广联达软件股份有限公司
 * </pre>
 *
 * @author :   lvyue
 * @version :  1.0
 * @date :     14/11/16 22:04
 */
public class ActionResultVO {

    private int code = 200;

    private String msg = "";

    private Map<String, Object> data = new HashMap<String, Object>();

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Map<String, Object> getData() {
        return data;
    }

    /**
     * 向data中设置数据
     *
     * @param key
     * @param obj
     * @return
     */
    public ActionResultVO put(String key, Object obj) {
        this.data.put(key, obj);
        return this;
    }

    /**
     * 从data中移除数据
     *
     * @param key
     * @return
     */
    public ActionResultVO remove(String key) {
        this.data.remove(key);
        return this;
    }

    /**
     * 数据清空
     *
     * @return
     */
    public ActionResultVO invalidate() {
        this.data.clear();
        this.code = 200;
        this.msg = "";
        return this;
    }
}
